﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GenericLibrariesToolKit;
using Utils;

namespace Model
{
    /// <summary>
    /// 招标公告实体
    /// </summary>
    public class BidBulletin
    {
        /*公告ID*/
        public string BulletinId { get; set; }
        /*招标ID*/
        public string BidId { get; set; }
        /*公告标题*/
        public string BulletinTitle { get; set; }
        /*公告细节*/
        public string BulletinDetail { get; set; }
        /*发布日期*/
        private string bulletinDate = DateTimeUtil.GetDateTime();
        public string BulletinDate
        {
            get { return bulletinDate; }
            set { bulletinDate = value; }
        }

        /// <summary>
        /// 应用程序启动时，实体管理器将会调用此方法进行初始化。
        /// </summary>
        public void Intialization()
        {
            //声明一个实体实体对象
            Entity entity = new Entity();

            //指定该实体对应数据库中的表名
            entity.TableName = "T_BID_BULLETIN";
            //指定该实体的标识符
            entity.EntityId = "BulletinId";
            //指定主键生成策略
            entity.Generator = GenericLibrariesToolKit.Enumeration.PKGenerationStrategy.GUID;
            ///实体关系映射字典
            ///key:实体属性名称，value:对应的数据库中表的字段名
            Dictionary<string, string> dictionary = new Dictionary<string, string>();

            dictionary.Add("BulletinId", "BULLETIN_ID");
            dictionary.Add("BidId", "BID_ID");
            dictionary.Add("BulletinTitle", "BULLETIN_TITLE");
            dictionary.Add("BulletinDetail", "BULLETIN_DETAIL");
            dictionary.Add("BulletinDate", "BULLETIN_DATE");

            //赋值
            entity.ORMDictionary = dictionary;

            //将实体加入实体管理器，
            EntityManager.GetInsatnce().AddEntity("Model.BidBulletin", entity);
        }
    }
}
